{extend name='common/common' /}

{block name="content"}
<el-card class="box-card">
	<div slot="header">
		<span class="span-primary"><i class="fa fa-list"></i></span>
		年度资金管理
	</div>
	<el-table :data="tableData" border>
		<el-table-column align="center" prop="id" label="序号" width="50"></el-table-column>
		<el-table-column align="center" label="地区" prop="depart_name"></el-table-column>
		<el-table-column align="center" label="地址" prop="address"></el-table-column>
		<el-table-column align="center" label="电话" prop="link_type"></el-table-column>
		<el-table-column align="center" label="查看">
			<template slot-scope="scope">
				{if authCheck('capitalmgr/seeyear')}
				<el-tooltip content="查看" open-delay="500" hide-after="1500" placement="right">
					<el-button
						@click="seeYear(scope.row)" circle
						size="mini" plain type="primary"
						icon="fa fa-eye">
					</el-button>
				</el-tooltip>
				{/if}
			</template>
		</el-table-column>
		<el-table-column align="center" label="添加">
			<template slot-scope="scope">
				{if authCheck('capitalmgr/addyear')}
				<el-tooltip content="添加" open-delay="500" hide-after="1500" placement="right">
					<el-button
						@click="addYear(scope.row)" circle
						size="mini" plain type="primary"
						icon="el-icon-plus">
					</el-button>
				</el-tooltip>
				{/if}
			</template>
		</el-table-column>
	</el-table>
	<div class="table-page">
		<el-pagination
			@size-change="pageSizeChange"
			@current-change="curPageChange"
			:current-page="pageNumber"
			:page-sizes="[10, 20, 50, 75]"
			:page-size="pageSize"
			layout="total, sizes, prev, pager, next, jumper"
			:total="tableTotal">
		</el-pagination>
	</div>
</el-card>
{/block}

{block name="script"}
<script type="text/javascript">
var main = new Vue({
	el:"#main",
	data:{
		loading:false,
		tableData:"",
		pageSize:10,
		pageNumber:1,
		tableTotal:0,
	},
	mounted:function() {
		this.getTable();
	},
	methods:{
		getTable() {
			this.loading=true;
			var param = {
				pageSize:this.pageSize,
				pageNumber:this.pageNumber,
					seaTime:this.seaTime
			};
			$.post('./index',param,function(res){
				main.loading=false;
				if(res.code == 1){
					main.$message({message: res.msg,type: 'success'});
					main.tableData = res.data.rows;
					main.tableTotal = res.data.total;
				}else{
					main.$notify.error({title: '失败',message: res.msg});
				}
			});
		},
		pageSizeChange(val) {
			this.pageSize = val;
			this.getTable();
		},
		curPageChange(val) {
			this.pageNumber = val;
			this.getTable();
		},
		addYear(row) {
			var url = "{:url('Capitalmgr/addYear')}?row_id="+row.id;
			window.location.href = url;
		},
		seeYear(row) {
			var url = "{:url('Capitalmgr/seeYear')}?row_id="+row.id;
			window.location.href = url;
		}
	}
})
</script>
{/block}
